package com.tencet.utils;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.util.Map;
import java.util.Properties;

/**
 * @author: aiming    @date: 2022/7/21 11:26
 * @description:
 */
public class DataSourceUtils {
    private DataSourceUtils(){}

    private static DataSource dataSource;

    static {
        try {
            Properties pro = new Properties();
            pro.load(DataSourceUtils.class.getClassLoader().getResourceAsStream("jdbc.properties"));
            dataSource = DruidDataSourceFactory.createDataSource(pro);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static DataSource getDataSource(){
        return dataSource;
    }
}
